<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/static/css/plugins/jquery-ui.css">
    <link href="__PUBLIC__/static/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <!-- Sweet Alert -->
    <link href="__PUBLIC__/static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <style type="text/css">
        .fancy{
            width:888px;
            height:auto;
        }
        .fancy h3{
            height:30px;
            line-height:30px;
            border-bottom:1px solid #d3d3d3;
            font-size:14px
        }

        .btn{
            -webkit-border-radius: 3px;
            -moz-border-radius:3px;
            padding:5px 12px;
            cursor:pointer
        }
        .btn_ok{
            background: #360;
            border: 1px solid #390;
            color:#fff
        }
        .btn_cancel{
            background:#f0f0f0;
            border: 1px solid #d3d3d3;
            color:#666
        }
        .btn_del{
            background:#f90;
            border: 1px solid #f80;
            color:#fff }
        .sub_btn{
            height:32px;
            line-height:32px;
            padding-top:6px;
            border-top:1px solid #f0f0f0;
            text-align:right;
            position:relative
        }
        .sub_btn .del{
            position:absolute;
            left:2px
        }
        #sel_start,#sel_end{
            line-height: 30px;
        }
    </style>
</head>
<body>
<div class="fancy">
    <div class="ibox ">
        <div class="ibox-content">
            <form class="form-horizontal m-t" action="{:U('update')}" id="myForm" method="post">

                <div class="form-group">
                    <label class="col-sm-2 control-label">日程名称：</label>
                    <div class="col-sm-4">
                        <input name="event" id="event" class="form-control" value="{$notes.event}" placeholder="这里输入您想要输入的日程"  autocomplete="off" type="text">
                    </div>
                    <!--类型：0、自定义，1.项目任务，2、客户沟通，3、订单沟通-->
                    <div class="col-xs-2">
                        <select name="type" class="form-control m-b">
                            <option value="0" <if condition="$notes['type'] eq 0"> selected </if>> 类 型 </option>
                            <option value="1" <if condition="$notes['type'] eq 1"> selected </if>>项目任务</option>
                            <option value="2" <if condition="$notes['type'] eq 2"> selected </if>>客户沟通</option>
                            <option value="3" <if condition="$notes['type'] eq 3"> selected </if>>订单沟通</option>
                        </select>
                    </div>
                    <!--0、最低，1、一般，2、优先，3、加急-->
                    <div class="col-xs-2">
                        <select name="status" class="form-control m-b">
                            <option value="0" <if condition="$notes['status'] eq 0"> selected </if>> 优先级</option>
                            <option value="1" <if condition="$notes['status'] eq 1"> selected </if>> 一 般 </option>
                            <option value="2" <if condition="$notes['status'] eq 2"> selected </if>> 优 先 </option>
                            <option value="3" <if condition="$notes['status'] eq 3"> selected </if>> 加 急 </option>
                            <option value="4" <if condition="$notes['status'] eq 4"> selected </if>> 已完成</option>
                        </select>
                    </div>
                    <!--指派给某某人-->
                    <div class="col-xs-2">
                        <if condition="$user['type'] neq 0">
                            <select name="uid" class="form-control m-b">
                                <option value="">不指派</option>
                                <volist name="member" id="vo">
                                    <option value="{$vo.uid}" <if condition="$notes['uid'] eq $vo['uid']"> selected </if>> <if condition="$vo['name']"> {$vo.name}<else/> {$vo.user}</if></option>
                                </volist>
                            </select>
                        </if>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">日程内容：</label>
                    <div class="col-sm-10">
                        <textarea name="content" id="editor" style="width: 100%; height: 200px; visibility: hidden;resize: none; display: none;" placeholder="可以是网址、联系人、图片、文章等！">{$notes.content}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-daterange input-group col-sm-12" id="datepicker">
                        <div class="col-sm-12" style="margin-bottom:10px ">
                            <label class="col-sm-2 control-label">开始时间：</label>
                            <div class="col-sm-10">
                                    <input type="text" class="input-sm form-control" name="start"  <notempty name="notes['startdate']"> value="{$notes['startdate']|date='Y-m-d',###}" </notempty>  <empty name="notes['startdate']"> value="{$date}" </empty>  style="width: 150px;" readonly/>

                                    <span id="sel_start" <notempty name="notes['allday']"> style="display:none" </notempty> <empty name="notes['allday']"> style="display:block" </empty>>
                                        &nbsp;
                                        <select name="s_hour">
                                            <option value="00" <if condition="date('H',$notes['startdate']) eq 0"> selected </if>>00</option>
                                            <option value="01" <if condition="date('H',$notes['startdate']) eq 1"> selected </if>>01</option>
                                            <option value="02" <if condition="date('H',$notes['startdate']) eq 2"> selected </if>>02</option>
                                            <option value="03" <if condition="date('H',$notes['startdate']) eq 3"> selected </if>>03</option>
                                            <option value="04" <if condition="date('H',$notes['startdate']) eq 4"> selected </if>>04</option>
                                            <option value="05" <if condition="date('H',$notes['startdate']) eq 5"> selected </if>>05</option>
                                            <option value="06" <if condition="date('H',$notes['startdate']) eq 6"> selected </if>>06</option>
                                            <option value="07" <if condition="date('H',$notes['startdate']) eq 7"> selected </if>>07</option>
                                            <option value="08" <if condition="date('H',$notes['startdate']) eq 8"> selected </if>>08</option>
                                            <option value="09" <if condition="date('H',$notes['startdate']) eq 9"> selected </if>>09</option>
                                            <option value="10" <if condition="date('H',$notes['startdate']) eq 10"> selected </if>>10</option>
                                            <option value="11" <if condition="date('H',$notes['startdate']) eq 11"> selected </if>>11</option>
                                            <option value="12" <if condition="date('H',$notes['startdate']) eq 12"> selected </if>>12</option>
                                            <option value="13" <if condition="date('H',$notes['startdate']) eq 13"> selected </if>>13</option>
                                            <option value="14" <if condition="date('H',$notes['startdate']) eq 14"> selected </if>>14</option>
                                            <option value="15" <if condition="date('H',$notes['startdate']) eq 16"> selected </if>>15</option>
                                            <option value="16" <if condition="date('H',$notes['startdate']) eq 16"> selected </if>>16</option>
                                            <option value="17" <if condition="date('H',$notes['startdate']) eq 17"> selected </if>>17</option>
                                            <option value="18" <if condition="date('H',$notes['startdate']) eq 18"> selected </if>>18</option>
                                            <option value="19" <if condition="date('H',$notes['startdate']) eq 19"> selected </if>>19</option>
                                            <option value="20" <if condition="date('H',$notes['startdate']) eq 20"> selected </if>>20</option>
                                            <option value="21" <if condition="date('H',$notes['startdate']) eq 21"> selected </if>>21</option>
                                            <option value="22" <if condition="date('H',$notes['startdate']) eq 22"> selected </if>>22</option>
                                            <option value="23" <if condition="date('H',$notes['startdate']) eq 23"> selected </if>>23</option>
                                        </select>:
                                        <select name="s_minute">
                                            <option value="00" <if condition="date('i',$notes['startdate']) eq 00"> selected </if>>00</option>
                                            <option value="10" <if condition="date('i',$notes['startdate']) eq 10"> selected </if>>10</option>
                                            <option value="20" <if condition="date('i',$notes['startdate']) eq 20"> selected </if>>20</option>
                                            <option value="30" <if condition="date('i',$notes['startdate']) eq 30"> selected </if>>30</option>
                                            <option value="40" <if condition="date('i',$notes['startdate']) eq 40"> selected </if>>40</option>
                                            <option value="50" <if condition="date('i',$notes['startdate']) eq 50"> selected </if>>50</option>
                                        </select>
                                    </span>

                            </div>
                        </div>

                        <div id="p_endtime" class="col-sm-12" <empty name="notes['enddate']">style="display:none"</empty>>
                            <label class="col-sm-2 control-label">结束时间：</label>
                            <div class="col-sm-10">
                                <input type="text" class=" input-sm form-control" name="end" <notempty name="notes['enddate']">value="{$notes['enddate']|date='Y-m-d',###}" </notempty>  <empty name="notes['enddate']">value="{$date}" </empty>  style="width: 150px;" readonly/>
                                <span id="sel_end" class="pull-left" <notempty name="notes['allday']"> style="display:none" </notempty> <empty name="notes['allday']"> style="display:block" </empty>>
                                    &nbsp;
                                    <select name="e_hour">
                                        <option value="00" <if condition="date('H',$notes['enddate']) eq 0"> selected </if>>00</option>
                                        <option value="01" <if condition="date('H',$notes['enddate']) eq 1"> selected </if>>01</option>
                                        <option value="02" <if condition="date('H',$notes['enddate']) eq 2"> selected </if>>02</option>
                                        <option value="03" <if condition="date('H',$notes['enddate']) eq 3"> selected </if>>03</option>
                                        <option value="04" <if condition="date('H',$notes['enddate']) eq 4"> selected </if>>04</option>
                                        <option value="05" <if condition="date('H',$notes['enddate']) eq 5"> selected </if>>05</option>
                                        <option value="06" <if condition="date('H',$notes['enddate']) eq 6"> selected </if>>06</option>
                                        <option value="07" <if condition="date('H',$notes['enddate']) eq 7"> selected </if>>07</option>
                                        <option value="08" <if condition="date('H',$notes['enddate']) eq 8"> selected </if>>08</option>
                                        <option value="09" <if condition="date('H',$notes['enddate']) eq 9"> selected </if>>09</option>
                                        <option value="10" <if condition="date('H',$notes['enddate']) eq 10"> selected </if>>10</option>
                                        <option value="11" <if condition="date('H',$notes['enddate']) eq 11"> selected </if>>11</option>
                                        <option value="12" <if condition="date('H',$notes['enddate']) eq 12"> selected </if>>12</option>
                                        <option value="13" <if condition="date('H',$notes['enddate']) eq 13"> selected </if>>13</option>
                                        <option value="14" <if condition="date('H',$notes['enddate']) eq 14"> selected </if>>14</option>
                                        <option value="15" <if condition="date('H',$notes['enddate']) eq 16"> selected </if>>15</option>
                                        <option value="16" <if condition="date('H',$notes['enddate']) eq 16"> selected </if>>16</option>
                                        <option value="17" <if condition="date('H',$notes['enddate']) eq 17"> selected </if>>17</option>
                                        <option value="18" <if condition="date('H',$notes['enddate']) eq 18"> selected </if>>18</option>
                                        <option value="19" <if condition="date('H',$notes['enddate']) eq 19"> selected </if>>19</option>
                                        <option value="20" <if condition="date('H',$notes['enddate']) eq 20"> selected </if>>20</option>
                                        <option value="21" <if condition="date('H',$notes['enddate']) eq 21"> selected </if>>21</option>
                                        <option value="22" <if condition="date('H',$notes['enddate']) eq 22"> selected </if>>22</option>
                                        <option value="23" <if condition="date('H',$notes['enddate']) eq 23"> selected </if>>23</option>
                                    </select>:
                                    <select name="e_minute">
                                        <option value="00" <if condition="date('i',$notes['enddate']) eq 00"> selected </if>>00</option>
                                        <option value="10" <if condition="date('i',$notes['enddate']) eq 10"> selected </if>>10</option>
                                        <option value="20" <if condition="date('i',$notes['enddate']) eq 20"> selected </if>>20</option>
                                        <option value="30" <if condition="date('i',$notes['enddate']) eq 30"> selected </if>>30</option>
                                        <option value="40" <if condition="date('i',$notes['enddate']) eq 40"> selected </if>>40</option>
                                        <option value="50" <if condition="date('i',$notes['enddate']) eq 50"> selected </if>>50</option>
                                    </select>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-6 col-sm-offset-2">
                        <label><input type="checkbox" value="1" id="isallday" name="isallday"  <notempty name="notes['allday']"> checked</notempty>> 全天</label>
                        <label><input type="checkbox" value="1" id="isend" name="isend" <notempty name="notes['enddate']"> checked </notempty>> 结束时间</label>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <div class="sub_btn">
                            <if condition="$action eq 'edit'">
                                <span class="del">
                                    <input type="button" class="btn btn_del" id="del_event" value="删除">
                                </span>
                                <input type="hidden" name="id" value="{$_GET['id']}" id="eventid">
                            </if>
                            <input type="submit" class="btn btn_ok" value="确定">
                            <input type="button" class="btn btn_cancel" value="取消" onClick="$.fancybox.close()">
                        </div>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/static/js/plugins/jquery.form.min.js"></script>
<script src="__PUBLIC__/static/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
<script src="__PUBLIC__/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var editor = KindEditor.create('#editor',{
            uploadJson : '__PUBLIC__/kindeditor/php/upload_json.php',
            fileManagerJson : '__PUBLIC__/kindeditor/php/file_manager_json.php',
            allowFileManager : true,
            afterBlur:function(){this.sync();}
        });
        //日期控件
        $("#datepicker").datepicker({
            keyboardNavigation: !1,
            forceParse: !1,
            autoclose: !0,
        });

        $("#isallday").click(function(){
            if($("#sel_start").css("display")=="none"){
                $("#sel_start,#sel_end").show();
            }else{
                $("#sel_start,#sel_end").hide();
            }
        });

        $("#isend").click(function(){
            if($("#p_endtime").css("display")=="none"){
                $("#p_endtime").show();
            }else{
                $("#p_endtime").hide();
            }
            $.fancybox.resize();//调整高度自适应
        });
        //提交表单
        $('#myForm').ajaxForm({
            beforeSubmit: showRequest, //表单验证
            success: showResponse, //成功返回
        });

        //删除事件
        $("#del_event").click(function(){
            if(confirm("您确定要删除吗？")){
                var eventid = $("#eventid").val();
                $.post("{:U('del')}",{id:eventid},function(data){
                    if(data==1){
                        $.fancybox.close();
                        $('#calendar').fullCalendar('refetchEvents'); //重新获取所有事件数据
                    }else{
                        swal('操作失败!',data, "warning");
                    }

                });
            }
        });

    });

    function showRequest(){
        var events = $("#event").val();
        if(events==''){
            swal('友情提示！',"请填写日程名称！", "warning");
            $("#event").focus();
            return false;
        }
    }

    function showResponse(responseText, statusText, xhr, $form){
        if(statusText=="success"){
            if(responseText==1){
                $.fancybox.close();
                $('#calendar').fullCalendar('refetchEvents'); //重新获取所有事件数据
            }else{
                alert(responseText);
            }
        }else{
            alert(statusText);
        }
    }
</script>
</body>


</html>